package com.itheima.deadloc;

import java.io.ObjectInputStream;

public class Demo01 {

    public static void main(String[] args) {
        Object oA = new Object();
        Object oB = new Object();
        new Thread(() -> {
            while (true) {
                synchronized (oA) {
                    System.out.println("坤坤获取到A锁");
                    synchronized (oB) {
                        System.out.println("坤坤获取到了B锁");
                    }
                    System.out.println("坤坤释放了B锁");

                }
                System.out.println("坤坤释放A锁");
            }
        }).start();

        new Thread(() -> {
            while (true) {
                synchronized (oB) {
                    System.out.println("签签获取到B锁");
                    haha();
                    System.out.println("签签释放了A锁");

                }
                System.out.println("签签释放B锁");
            }
        }).start();


    }

    private  synchronized static void haha() {

    }
}
